#include "ArrayQueue.h"

void initQueue(ArrayQueue* q)
{
	q->front = q->rear = 0;
}

void pushQueue(ArrayQueue* q, Element_t e)
{
	if (isFull(q))
	{
		return;
	}
	q->rear = (q->rear + 1) % maxsize;
	q->data[q->rear] = e;
}

void popQueue(ArrayQueue* q)
{
	if (isEmpty(q))
	{
		return;
	}
	q->front = (q->front + 1) % maxsize;
}

bool isFull(ArrayQueue* q)
{
	if ((q->rear + 1) % maxsize == q->front)
	{
		return true;
	}
	return false;
}

bool isEmpty(ArrayQueue* q)
{
	if (q->front == q->rear)
	{
		return true;
	}
	return false;
}
